﻿using Microsoft.Xna.Framework;

namespace WindowsGame.Manager
{
	/// <summary>
	/// ScreenManager is responsible for managing all screens in game.
	/// </summary>
	public interface IScreenManager
	{
		void Update(GameTime gameTime);
		void Draw();
	}

	public class ScreenManager : IScreenManager
	{
		// ScreenManager has dependency on GameObjectManager and GraphicsManager.
		private readonly IGameObjectManager gameObjectManager;
		private readonly IGraphicsManager graphicsManager;

		public ScreenManager(IGameObjectManager gameObjectManager, IGraphicsManager graphicsManager)
		{
			this.gameObjectManager = gameObjectManager;
			this.graphicsManager = graphicsManager;
		}

		// Update each game object using GameObjectManager.
		public void Update(GameTime gameTime)
		{
			gameObjectManager.Update(gameTime);
		}

		// Draw each game object using GameObjectManager.
		public void Draw()
		{
			graphicsManager.GraphicsDevice.Clear(Color.Black);
			gameObjectManager.Draw();
		}
	}
}